import axios from 'axios'

export const fetchReviewStages = async (packageId) => {
  try {
    const { data } = await axios.get(`/api/reviews/${packageId}/stages`, {
      headers: {
        'X-Deepin-Client': 'submission-tool/1.0'
      }
    })
    
    return data.stages.map(stage => ({
      title: stage.name,
      description: stage.comment || '等待审核',
      time: stage.updated_at,
      passed: stage.status === 'approved',
      failed: stage.status === 'rejected'
    }))
  } catch (error) {
    console.error('审核状态获取失败:', error.response?.data?.message)
    throw new Error('无法连接审核服务器')
  }
}